import React from 'react';
import { Select } from 'antd';
import PropTypes from 'prop-types';

const { Option } = Select;

const BorrowStatusFilter = ({ value, onChange, style }) => {
  // 借用状态选项
  const statusOptions = [
    { value: '全部', label: '全部' },
    { value: '待审批', label: '待审批' },
    { value: '借用中', label: '已批准' },
    { value: '已拒绝', label: '已拒绝' },
    { value: '已归还', label: '已归还' }
  ];

  const handleChange = (selectedValue) => {
    onChange?.(selectedValue === '全部' ? null : selectedValue);
  };

  return (
    <Select
      value={value || '全部'}
      onChange={handleChange}
      style={{ width: 120, ...style }}
      placeholder="借用状态"
    >
      {statusOptions.map(option => (
        <Option key={option.value} value={option.value}>
          {option.label}
        </Option>
      ))}
    </Select>
  );
};

BorrowStatusFilter.propTypes = {
  value: PropTypes.string,
  onChange: PropTypes.func,
  style: PropTypes.object
};

export default BorrowStatusFilter;
